
{% load files %}
<h1>
    <a class="AddButton button floatleft" href="{% course_url management app='users' command='edit' %}" title="Add a new User">+</a>
    <span class="floatleft">Users</span>
    <a class="AddButton button floatleft" href="{% course_url management app='users' command='upload' %}" title="Add multiple new Users">++</a>
</h1>
{% if Users %}
<a class="button smallbutton floatright" href="{% url email-course course.course_id %}" target="_blank" title="Email the class">Email Everyone</a>
{% endif %}
<div class="clear"></div>
    {% if Users %}
<table border="0">
    {% regroup Users by get_status_display as Users%}
    {% for group in Users %}
        <tr><th class="heading" colspan="100%"><h3>{{group.grouper|lower|capfirst}}</h3></th></tr>
    <tr><th class="border-bottom" colspan="2">User</th><th class="border-bottom">Username</th><th class="border-bottom">Email</th><th colspan="100%" class="border-bottom">Options</th></tr>
    {% for user in group.list %}
        <tr>
            {% get_file_list for user.user as Files %}
            <td><img src="{% if Files.avatar %}{{Files.avatar.url}}{% else %}{{STATIC_URL}}images/BlankAvatar.png{% endif %}" height="75"></td>
            <th>{{user.user.last_name}}, {{user.user.first_name}}</th>
            <td>{{user.user.username}}</td>
            <td>{{user.user.email}}</td>
            <td class="management_option">
                <a class="button smallbutton" href="{% course_url management app='users' command='edit' arguments=user.user.username %}" title="Edit this user's profile">Edit</a>
                <a class="button smallbutton" href="{% course_url management app='users' command='remove' arguments=user.user.username %}" title="Remove this user from this class">Remove</a>
                <a class="button smallbutton" href="{% course_url apps.participants.views.view_profile username=user.user.username %}" title="View this user's profile">View</a>
            {% if user.user.email %}
                <a class="button smallbutton" href="{% course_url email-user user.user.username %}" target="_blank" title="Email this user">Email</a>
            {% endif %}
            </td>
        </tr>
    {% endfor %}
    {% endfor %}
</table>
    {% else %}
    <p>No users are registered for this course </p>
{% endif %}

{% if OtherUsers %}
<table border="0">
    <tr><th class="border-bottom" colspan="2">User</th><th class="border-bottom">Username</th><th class="border-bottom">Email</th><th colspan="100%" class="border-bottom">Options</th></tr>
    {% for user in OtherUsers %}
        <tr>
            {% get_file_list for user as Files %}
            <td><img src="{% if Files.avatar %}{{Files.avatar.url}}{% else %}{{STATIC_URL}}images/BlankAvatar.png{% endif %}" height="75"></td>
            <th>{{user.last_name}}, {{user.first_name}}</th>
            <td>{{user.username}}</td>
            <td>{{user.email}}</td>
            
        </tr>
    {% endfor %}
</table>
    
    {% endif %}
